package com.wxg.prism;

import org.beetl.core.GroupTemplate;
import org.beetl.core.Template;

import com.jfinal.core.Controller;
import com.wxg.kit.DownloadRemoteFile;
import com.wxg.util.MyBeetlUtil;

public class PrismController extends Controller{

	public void index(){
		GroupTemplate gt = MyBeetlUtil.gt();
		Template t = gt.getTemplate("/prism/beetl/test01.btl");
		t.binding("prismLanguage", "java");
		
		DownloadRemoteFile drf = new DownloadRemoteFile();
		String path = "http://git.oschina.net/juedui0769/thinkinginjava/raw/master/thinkinginjava/src/main/java/access/Cake.java";
		
		t.binding("prismCode", drf.fetchRemoteFile(path));
		String beetlStr = t.render();
		renderText(beetlStr);
	}
	
	public void renderJavaCode(){
		GroupTemplate gt = MyBeetlUtil.gt();
		Template t = gt.getTemplate("/prism/beetl/test01.btl");
		t.binding("prismLanguage", "java");
		
		DownloadRemoteFile drf = new DownloadRemoteFile();
		String path = "http://git.oschina.net/juedui0769/thinkinginjava/raw/master/thinkinginjava/src/main/java/access/Cake.java";
		
		t.binding("prismCode", drf.fetchRemoteFile(path));
		String beetlStr = t.render();
		renderText(beetlStr);
	}
	
}
